Assignment #125 Summing Three Numbers from Any File
Code
///Name: Ian Grant
///Period:5
///Project Name: Summing Three Numbers from Any File
///File Name:bs.java
///06/06/16
import java.io.File;
import java.util.Scanner;
class bs
{
public static void main (String [] args) throws Exception
{
Scanner stuff = new Scanner(System.in);
System.out.println("Which file you want: ");
String imput = stuff.next();
int a,b,c;
Scanner fileIn = new Scanner(new File((String)imput));
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
fileIn.close();
System.out.println(a+" +"+b+"+"+c+"="+(a+b+c));
}
}
Output